﻿<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<meta name="apple-itunes-app" content="app-id=591578609">
	<meta name="viewport" content="width=device-width"/>
	<meta name="description" content="筑学堂网校" />
	
	<link rel="stylesheet" type="text/css" href="../../style/share/style.css">
	<link rel="stylesheet" type="text/css" href="../../style/share/kczx.css">
	<link rel="stylesheet" type="text/css" href="../../style/share/home_style.css">
	<link rel="stylesheet" type="text/css" href="../../style/user.css">
	
	<script type="text/javascript">
	
	 $(function(){
	    	var topicId = "${topicId}";
	    	if(null!=topicId && "" != topicId){
	    		topicDetail(topicId);
	    	}
	     });
		    
	    
	 function addTopic(){
		 $.ajax({ url: "../query_homeGroup_topic_add_page/${group_id}", 
		       success: function(result){
	              $("#mainPageDiv").html(result);
	           }
	     });	
	 }
	 
	 //群话题详细页面
	  function topicDetail(topic_id){
		 $.ajax({ url: "../query_homeGroup_topic_detail/"+topic_id, 
		       success: function(result){
	              $("#mainPageDiv").html(result);
	           }
	     });	
	 }
	 
	  //首页
	   function firstPage(){
		  $.ajax({ url: "../query_group_topic/${group_id}/1/${pageSize}", 
			       success: function(result){
		              $("#mainPageDiv").html(result);
		           }
		  });
		}
	 //上一页
	   function upPage(){
		      var pageNo = '${pageNo}';
		      var upNo = Number(pageNo) - 1 ;
		      if(Number(pageNo)>1){
		    	  $.ajax({ url: "../query_group_topic/${group_id}/"+upNo+"/${pageSize}", 
				       success: function(result){
			              $("#mainPageDiv").html(result);
			           }
			     });
		      }
			  
		}
	   //下一页
	   function nextPage(){
		      var pageNo = '${pageNo}';
		      var sumPageNum = '${sumPageNum}';
		      var nextNo = Number(pageNo) + 1 ;
		      if(Number(pageNo)<Number(sumPageNum)){
		    	  $.ajax({ url: "../query_group_topic/${group_id}/"+nextNo+"/${pageSize}", 
				       success: function(result){
			              $("#mainPageDiv").html(result);
			           }
			     });
		      }
		}
	   //跳转页
	   function gotoPage(obj){
		      var pageNo = $(obj).val();
			  $.ajax({ url: "../query_group_topic/${group_id}/"+pageNo+"/${pageSize}", 
				       success: function(result){
			              $("#mainPageDiv").html(result);
			           }
			  });
		}
	  
	</script>

</head>

<body style="clear:both;align:center;">
	<div class="home_group">
		
		<div class="home_groupnotice" style="min-height:30px;">
		<c:if test="${isMember==0}">
			<a href="#" onclick="addTopic()">
				<div class="pic_top02" style="position:relative;left:0px;top:10px;float:right;background-color:#209E85;color:#EEE"> 
				 <img src="../../images/add.png"> 新增话题 </div>
			</a>
		</c:if>
			
		</div>
		
			<div class="home_groupnotice">
				<div class="home_grnottit" style="margin-bottom:20px;"> 群话题 </div>
				<div class="home_groupnot" style="text-indent:1em;">
					<ul>
						<li>
							<ul style="width:100%;height:auto;background-color:#B3DDDF;"">
								<li style="width:250px;background-color:#B3DDDF;"> 话题 </li>
								<li  style="background-color:#B3DDDF;"> 作者 </li>
								<li  style="background-color:#B3DDDF;"> 浏览 </li>
								<li  style="background-color:#B3DDDF;"> 回复 </li>
								<li  style="background-color:#B3DDDF;"> 最新回复 </li>
							</ul>
						</li>
						 <c:forEach items="${data.data}" var="li">
							<li>
								<ul style="width:100%;height:auto;">
									<a href="#" onclick="topicDetail('${li.id}')">
									  <li style="width:250px;"> ${li.topic_nm} </li>
									</a>
									<li> <a href="http://space.zhuclass.com/#/${li.create_id}/home">
										${li.create_nm}
									     <c:if test="${li.create_nm=='' ||li.create_nm == null }">
									               作者不详
									     </c:if>
									     </a>
									</li>
									<li> ${li.view_cnt} </li>
									<li> ${li.reply_cnt} </li>
									<li> ${li.last_reply_nm}
									     <c:if test="${li.last_reply_nm=='' ||li.last_reply_nm == null }">
									                      无最新回复
									     </c:if>
									 </li>
								</ul>
							</li>
						</c:forEach>
					</ul>
				</div>
				
			</div>
			
			<!--页面切换-->
				<div class="page_div">
					<div class="page_body">
					    <a href="#"> 
					      <div class="kczx_divlb01" onclick="firstPage()" >首&nbsp;页</div>
						</a>
						
						<div class="kczx_divlb02"></div>
						
						<a href="#">
						  <div class="kczx_divlb01" onclick="upPage()" >上一页</div>
						</a>
						
						<div class="kczx_divlb02"></div>
						
						<a href="#">
						 <div class="kczx_divlb01" onclick="nextPage()" >下一页</div>
						</a>
						
						<div class="kczx_divlb02"></div>
						<select class="kczx_divlb01 page_select" onchange="gotoPage(this)" id="hostSelect">
						    <c:forEach begin="1" end="${sumPageNum}" var="i">  
							     <option value="${i}" <c:if test="${pageNo == i}"> selected="selected" </c:if>  >
							        第${i}页
							     </option>
						     </c:forEach> 
						</select>
					</div>
				</div>
				<!--end页面切换--> 
				
		</div>
	</div>
	
</body>
</html>